<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>系统人员</title>
    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
    <style>
        .layui-upload-img{
            border: 1px solid #1E9FFF;
            width: 200px;
            height: 200px;
            border-radius: 25px;

        }
    </style>
</head>
<body>

<div style="margin: 20px">
    <form class="layui-form layui-form-pane">
        <input type="hidden" id="img" name="img" th:value="${c.commentImgId}">
        <input type="hidden" name="id" th:value="${c.id}">
        <div class="layui-form-item" style="text-align: left">
            <div class="layui-input-block">
                <a class="layui-btn layui-btn-normal" readonly="readonly"   style="width: 200px">评论照片</a>
                <div class="layui-upload-list">
                    <img th:src="@{'/file/fc/showImg/'+${c.commentImgId}}" class="layui-upload-img"  id="photo">
                    <p id="photoText"></p>
                </div>
                <div>
                    <div class="layui-progress layui-progress-big" lay-showpercent="yes"
                         lay-filter="photoProgress"  style="width: 200px">
                        <div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户ID</label>
            <div class="layui-input-block">
                <input class="layui-input" th:value="${c.userId}" readonly="readonly"name="userId" autocomplete="off" placeholder="输入品牌名称">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商品ID</label>
            <div class="layui-input-block">
                <input class="layui-input" th:value="${c.commodityId}"readonly="readonly" name="commodityId" autocomplete="off" placeholder="输入品牌的介绍">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">打分</label>
            <div class="layui-input-block">
                <input class="layui-input" th:value="${c.score}" readonly="readonly"name="score" autocomplete="off" placeholder="输入品牌的介绍">
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">评论内容</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容"  readonly="readonly" th:text="${c.commentContent}" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-form-item" style="display: none">
            <div class="layui-input-block">
                <a class="layui-btn" lay-submit="" lay-filter="submitBtn" id="submitBtn"></a>
            </div>
        </div>
    </form>
</div>
<script>
    var $;
    layui.use(['form','jquery','upload','element','layer'],function () {
        var form = layui.form,
            upload = layui.upload,
            layer = layui.layer,
            elem = layui.element;
        $ = layui.jquery;


        //头像上传
        var photoUpload = upload.render({
            elem:'#checkPhoto',
            url:'/file/fc/fileUpload',
            before: function (obj) {
                obj.preview(function (i,f,r) {
                    $('#photo').attr('src',r);
                });
                elem.progress('photoProgress','0%');
            },
            done:function (res) {
                if(!res.is){
                    layer.alert('上传失败，请稍后再试......')
                }else{
                    $('#img').val(res.file.id);
                }
            },
            error:function(){

            },
            progress:function (n,el,e) {
                elem.progress('photoProgress',n+'%');
                if(n==100){
                    layer.msg('上传完成!',{icon:1});
                }
            }
        })



    })

    function btnSubmit() {
        $('#submitBtn').click();
    }
</script>

</body>
</html>